package com.exam.api.modules.goods.controller;

import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/open/callback")
@Log4j2
public class CallbackController {

//    @Resource
//    private OpenCallbackService openCallbackService;
//
//    @Parameter(name = "code", description = "", in = ParameterIn.PATH, required = true)
//    @Operation(summary = "小红书订单", description = "")
//    @PostMapping("/xhsOrder")
//    public Map<String,Object> xhsOrderChange(@RequestBody List<XhsMessage> messages) {
//        log.info("小红书回调:{}",messages);
//        messages.forEach(message -> {
//            if("msg_fulfillment_status_change".equals(message.getMsgTag())){
//                log.info("订单状态改变:{}",message);
//                XhsOrderMessage orderMessage = JSONUtil.toBean(message.getData(), XhsOrderMessage.class);
//                openCallbackService.orderChangeCallback(orderMessage.getOrderId());
//            }else if("msg_fulfillment_receiver_change".equals(message.getMsgTag())){
//                log.info("订单收货人信息改变:{}",message);
//            }else if("msg_item_buyable".equals(message.getMsgTag())){
//                log.info("msg_item_buyable:{}",message);
//            }else if("msg_sku_buyable".equals(message.getMsgTag())){
//                log.info("msg_sku_buyable:{}",message);
//            }else if("msg_after_sale_refund_finished".equals(message.getMsgTag())){
//                XhsRefundMessage orderMessage = JSONUtil.toBean(message.getData(), XhsRefundMessage.class);
//                openCallbackService.refundChangeCallback(orderMessage.getOrderId());
//            }
//        });
//        Map<String,Object> map = new HashMap<>();
//        map.put("success",true);
//        map.put("error_code",0);
//        map.put("error_msg","成功");
//        return map;
//    }
}
